#ifndef MYSESSIONCB_H
#define MYSESSIONCB_H

#include <QObject>
#include <Glacier2/Glacier2.h>

class MySessionCB : public QObject, public Glacier2::SessionCallback
{
    Q_OBJECT
public:
    enum State{STT_CREATEDCOMMUNICATOR,STT_CONNECTED,STT_DISCONNECTED,STT_CONNECTFAILED};
    explicit MySessionCB(QObject *parent = 0);
protected:
    virtual void createdCommunicator(const Glacier2::SessionHelperPtr &session) override;
    virtual void connected(const Glacier2::SessionHelperPtr &session) override;
    virtual void disconnected(const Glacier2::SessionHelperPtr &session) override;
    virtual void connectFailed(const Glacier2::SessionHelperPtr &session, const Ice::Exception &ex) override;
signals:
    void sig_Notify(int state, const QString &content);
private:
    void stateChanged(State s, const QString &reson = "");
};

typedef IceUtil::Handle<MySessionCB> MySessionCBPtr;

#endif // MYSESSIONCB_H
